#!/usr/bin/env python
# -*- coding:utf-8 -*-

#---------->大小写 .upper()/.lower()<-------------------

# code = input("请输入验证码：")
# new_code = code.lower()
# if new_code == "iftu":
#     print("验证通过")
# else:
#     print("验证失败，请重新输入")

# code = input("请输入验证码：")
# new_code = code.upper()
# if new_code == "IFTU":
#     print("验证通过")
# else:
#     print("验证失败，请重新输入")

#-----》去除字符串里的空格strip/lstrip/rstrip《--------

# word = input("请输入用户名：")
# new_word = word.strip()
# l_new_word = word.lstrip()
# r_new_word = word.rstrip()
# print("--->",word,"<---->",new_word,"<---->",l_new_word,"<---->",r_new_word,"<----")

#----------------->判断输入的字符串是否是数字isdigit()<---------------------

# choice = input("""可选业务为:
# 1. 查询话费
# 2. 查询套餐
# 3. 查流量
# 请选择您需要的服务：""")
# flag = choice.isdigit()
#
# if flag:
#     if 0< int(choice) <= 3:
#         print(choice)
#     else:
#         print("请输入正确的选项")
# else:
#     print("输入错误，请输入正确的数字")


#-------------------->替换字符串里的字符replace()<----------------------

# cont = input("请输入字符串:")
# new_cont = cont.replace("大爷", "**")
# new_cont_2 = cont.replace("大爷", "**", 2)
# print(cont)
# print(new_cont)
# print(new_cont_2)

#----------------->切片split(), join():将序列中的元素以指定的字符连接生成一个新的字符串<-----------------

# list = "春眠不觉晓，处处闻笛鸟，夜来风雨声，花落知多少"
#
# new_list = list.split("，")
# str = "，"
# add_new_list = str.join(new_list)
# print(new_list)
# print(add_new_list)

#--------------------------------》切片的方式，把字符串内容从右往左反转显示, reverse 是用在列表中的，不属于字符串的功能《--------------------------------

# str = "lovely cat"
# new_str = str[::-1]
# print(new_str)
# print(str[0:3])
# print(str[0::-1])
# print(str[0::2])


#-------------------->startswith（）/endswith判定字符串是否是以指定的内容开头<-----------------------------

# str = "lovely cat"
# new_str_e = str.endswith("a0t")
# new_str = str.startswith("lo")
# print(new_str)
# print(new_str_e)

#-------------------->join()<-------------------------

# str = "flower"
# print("-".join(str))

#-------------------------->format 字符串的格式化<--------------------------

# str = "我有{0}朵{1}花".format(10,"芍药")
# print(str)

#--------------------------->encode 改变字符串的编码方式<-----------------------------

# str = "芍药花"
# str1 = str.encode("utf-8")
# str2 = str.encode("gbk")
# print(str1)
# print(str2)


#----------------------->反转字符串内容，range<-----------------------------
st = "望八荒霓虹变换"
len_st = len(st)
new_st = ""
print(st[0:3])
for i in range(len_st-1,-1,-1):
    new_st = new_st + st[i]
print(new_st)


